#!/bin/bash

cpmunge () {
        if ! echo $CP | /usr/bin/egrep -q "(^|:)$1($|:)" ; then
           if [ "$2" = "after" ] ; then
              CP=$CP:$1
           else
              CP=$1:$CP
           fi
        fi
}

addjars () {
    for thejar in $1/*.jar
      do
      if [ -f "$thejar" ]; then
          cpmunge "$thejar"
      fi
    done
}

if [ -d "lib" ]; then
    addjars lib
fi

cpmunge build/classes
prog=org.six11.olive.Main
flags=--load-path=slippy-code
java -classpath $CP $prog $flags $@
